import Vue from 'vue'
import Vuex from 'vuex'

import market from './market';

Vue.use(Vuex);

export default new Vuex.Store({
  modules: {
    market
  },
  state: {
    loginInfo: {

    },
    toast: {
      isShow: false,
      config: {
        msg: '',
        width: '7.6em',
      }
    }
  },
  mutations: {
    SHOW_TOAST: (state, config) => {
        state.toast.isShow = true;
        state.toast.config.msg = config.msg;
        state.toast.config.width = config.width || '7.6em';
    },
    HIDE_TOAST: (state, config) => {
      state.toast.isShow = false;
      state.toast.config.msg = '';
      state.toast.config.width = '';
    }
  }
});
